home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / language / xscheme.arc / xscheme.doc < prev    next >
Text File  |  1989-02-01  |  52KB  |  2,839 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                        XSCHEME: An Object-oriented Scheme
  8.  
  9.                                   Version 0.16
  10.  
  11.                                 January 9, 1989
  12.  
  13.  
  14.                                        by
  15.                                David Michael Betz
  16.                                   P.O. Box 144
  17.                              Peterborough, NH 03458
  18.  
  19.                              (603) 924-4145 (home)
  20.  
  21.                    Copyright (c) 1989, by David Michael Betz
  22.                               All Rights Reserved
  23.            Permission is granted for unrestricted non-commercial use
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.         XSCHEME                TABLE OF CONTENTS                  Page 2
  71.  
  72.  
  73.         TABLE OF CONTENTS
  74.  
  75.             TABLE OF CONTENTS..................................2
  76.             INTRODUCTION.......................................3
  77.             A NOTE FROM THE AUTHOR.............................4
  78.             EXPRESSIONS........................................5
  79.             BINDING FORMS.....................................10
  80.             SEQUENCING........................................11
  81.             DELAYED EVALUATION................................12
  82.             ITERATION.........................................13
  83.             DEFINITIONS.......................................14
  84.             LIST FUNCTIONS....................................15
  85.             DESTRUCTIVE LIST FUNCTIONS........................17
  86.             SYMBOL FUNCTIONS..................................18
  87.             VECTOR FUNCTIONS..................................19
  88.             ARRAY FUNCTIONS...................................20
  89.             CONVERSION FUNCTIONS..............................21
  90.             TYPE PREDICATES...................................22
  91.             EQUALITY PREDICATES...............................25
  92.             ARITHMETIC FUNCTIONS..............................26
  93.             NUMERIC COMPARISON FUNCTIONS......................29
  94.             BITWISE LOGICAL FUNCTIONS.........................30
  95.             STRING FUNCTIONS..................................31
  96.             STRING COMPARISON FUNCTIONS.......................32
  97.             CHARACTER COMPARISON FUNCTIONS....................33
  98.             INPUT/OUTPUT FUNCTIONS............................34
  99.             OUTPUT CONTROL FUNCTIONS..........................36
  100.             FILE I/O FUNCTIONS................................37
  101.             CONTROL FEATURES..................................39
  102.             ENVIRONMENT FUNCTIONS.............................40
  103.             UTILITY FUNCTIONS.................................41
  104.             SYSTEM FUNCTIONS..................................42
  105.             OBJECT REPRESENTATIONS............................43
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.         XSCHEME                   INTRODUCTION                    Page 3
  137.  
  138.  
  139.         XScheme is an implementation of the Scheme programming language
  140.         with extensions to support object-oriented programming.
  141.  
  142.         There are currently implementations of XScheme running on the
  143.         IBM-PC and clones under MS-DOS, on the Macintosh, the Atari-ST
  144.         and the Amiga.  It is completely written in the programming
  145.         language 'C' and is easily extended with user written built-in
  146.         functions and classes.  It is available in source form to non-
  147.         commercial users.
  148.  
  149.         This document is a brief description of XScheme.  XScheme
  150.         follows the "Revised^3 Report on the Algorithmic Language
  151.         Scheme".  It assumes some knowledge of Scheme or LISP and some
  152.         understanding of the concepts of object-oriented programming.
  153.  
  154.         I recommend the book "Structure and Interpretation of Computer
  155.         Programs" by Harold Abelson and Gerald Jay Sussman and published
  156.         by The MIT Press and the McGraw-Hill Book Company for learning
  157.         Scheme (and programming in general).  You might also find "The
  158.         Scheme Programming Language" by R. Kent Dybvig and "The Little
  159.         Lisper" by Daniel P. Friedman and Matthias Felleisen to be
  160.         helpful.
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.         XSCHEME              A NOTE FROM THE AUTHOR               Page 4
  203.  
  204.  
  205.         A NOTE FROM THE AUTHOR
  206.  
  207.         If you have any problems with XScheme, feel free to contact me
  208.         for help or advice.  Please remember that since XScheme is
  209.         available in source form in a high level language, many users
  210.         have been making versions available on a variety of machines.
  211.         If you call to report a problem with a specific version, I may
  212.         not be able to help you if that version runs on a machine to
  213.         which I don't have access.  Please have the version number of
  214.         the version that you are running readily accessible before
  215.         calling me.
  216.  
  217.         If you find a bug in XScheme, first try to fix the bug yourself
  218.         using the source code provided.  If you are successful in fixing
  219.         the bug, send the bug report along with the fix to me.  If you
  220.         don't have access to a C compiler or are unable to fix a bug,
  221.         please send the bug report to me and I'll try to fix it.
  222.  
  223.         Any suggestions for improvements will be welcomed.  Feel free to
  224.         extend the language in whatever way suits your needs.  However,
  225.         PLEASE DO NOT RELEASE ENHANCED VERSIONS WITHOUT CHECKING WITH ME
  226.         FIRST!!  I would like to be the clearing house for new features
  227.         added to XScheme.  If you want to add features for your own
  228.         personal use, go ahead.  But, if you want to distribute your
  229.         enhanced version, contact me first.
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.         XSCHEME                   EXPRESSIONS                     Page 5
  269.  
  270.  
  271.         EXPRESSIONS
  272.  
  273.         <variable>
  274.  
  275.             An expression consisting of a variable is a variable
  276.             reference.  The value of the variable reference is the value
  277.             stored in the location to which the variable is bound.  It
  278.             is an error to reference an unbound variable.
  279.  
  280.         (QUOTE <datum>)
  281.         '<datum>
  282.  
  283.             (quote <datum>) evaluates to <datum>.  <Datum> may be any
  284.             external representation of a Scheme object.  This notation
  285.             is used to include literal constants in Scheme code.  (quote
  286.             <datum>) may be abbreviated as '<datum>.  The two notations
  287.             are equivalent in all respects.
  288.  
  289.         <constant>
  290.  
  291.             Numeric constants, string constants, character constants,
  292.             and boolean constants evaluate "to themselves"; they need
  293.             not be quoted.
  294.  
  295.         (<operator> <operand>...)
  296.  
  297.             A procedure call is written by simply enclosing in
  298.             parentheses expressions for the procedure to be called and
  299.             the arguments to be passed to it.  The operator and operand
  300.             expressions are evaluated and the resulting procedure is
  301.             passed the resulting arguments.
  302.  
  303.         (<object> <selector> <operand>...)
  304.  
  305.             A message sending form is written by enclosing in
  306.             parentheses expressions for the receiving object, the
  307.             message selector, and the arguments to be passed to the
  308.             method.  The receiver, selector, and argument expressions
  309.             are evaluated, the message selector is used to select an
  310.             appropriate method to handle the message, and the resulting
  311.             method is passed the resulting arguments.
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.         XSCHEME                   EXPRESSIONS                     Page 6
  335.  
  336.  
  337.         (LAMBDA <formals> <body>)
  338.  
  339.             <Formals> should be a formal argument list as described
  340.             below, and <body>  should be a sequence of one or more
  341.             expressions.  A lambda expression evaluates to a procedure.
  342.             The environment in effect when the lambda expression is
  343.             evaluated is remembered as part of the procedure.  When the
  344.             procedure is later called with some actual arguments, the
  345.             environment in which the lambda expression was evaluated
  346.             will be extended by binding the variables in the formal
  347.             argument list to fr